package com.pat.miniloyalty.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DecoratedTabPanel;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.StackPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class UserInterface implements EntryPoint
{

	private FlexTable m_tranTable = null;
	private FlexTable m_usersTable = null;
	private StackPanel m_verticalMenu = null;
	private HorizontalPanel m_topMenu = null;
	private VerticalPanel m_mainPanel = null;
	private DecoratedTabPanel m_tabPanel = null;
	private Image m_logo = null;
	
	public void onModuleLoad()
	{
		m_logo = new Image();
		m_logo.setUrl("images/av1.png");
		
		m_topMenu = new HorizontalPanel();
		m_topMenu.add(m_logo);
		
		m_verticalMenu = new StackPanel();
//		m_verticalMenu.setStackText(0, "Users");
//		m_verticalMenu.setStackText(1, "Transactions");
		m_verticalMenu.add(new Label("User list"), "Users");
//		m_verticalMenu.add(new Label("Create user"), "Users");
		m_verticalMenu.add(new Label("Transactions list"), "Transactions");
		
		m_tabPanel = new DecoratedTabPanel();
		
		m_tranTable = new FlexTable();
		m_tranTable.setText(0, 0, "#");
		m_tranTable.setText(0, 1, "Uid");
		m_tranTable.setText(0, 2, "User");
		m_tranTable.setText(0, 3, "Date");
		m_tranTable.setText(0, 4, "Price");
		
		m_usersTable = new FlexTable();
		m_usersTable.setText(0, 0, "#");
		m_usersTable.setText(0, 1, "Name");
		m_usersTable.setText(0, 2, "Total transactions");
		m_usersTable.setText(0, 3, "Totals");
		
		m_tabPanel.add(m_tranTable, "Transactions");
		m_tabPanel.add(m_usersTable, "Users");
		m_tabPanel.selectTab(0);
		
		m_mainPanel = new VerticalPanel();
		m_mainPanel.add(m_topMenu);
		m_mainPanel.add(m_verticalMenu);
		m_mainPanel.add(m_tabPanel);
		
		RootPanel.get().add(m_mainPanel);
	}

}
